package com.kevin.S2SM.web.view;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@SuppressWarnings("serial")
public class ValidatorTest extends GenericAction {

	private String userName;
	private String password;

	@Override
	public String doExecute(HttpServletRequest req, HttpServletResponse res)
			throws Exception {

		return this.SUCCESS;
	}

	@Override
	public void validate() {
		if ("".equals(userName)) {
			this.addActionError("userName is Require");

			return;
		}

		if (!"kevin".equals(this.getPassword())) {
			this.addFieldError("password", "password is mistake");

			return;
		}
		
		this.addActionError("no error");
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}
}
